/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Service;

import Util.StringUtils;
import Util.TranslatorUtils;
import java.util.HashMap;
import java.util.Map;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.apache.log4j.Logger;

/**
 *
 * @author Peat
 */
public class BaseService {

    protected Logger logger = Logger.getLogger(BaseService.class);
    private ConnectEJB conn;
    protected InitialContext ic;
    protected Map<String, Object> cache = new HashMap<String, Object>();

    protected void readyEJB(String connString) throws NamingException
    {
        if (StringUtils.isNullOrEmpty(connString))
        {
            connString = "t3://10.89.75.31:7027";
        }
//        throw new NamingException("Fake exception: " + TranslatorUtils.ASCII2Unicode("เจ๊กตะระเข้ว"));
        this.conn = new ConnectEJB(connString);
        logger.info("EJB Connection: " + connString);
        this.ic = this.conn.getInitialContext();
    }
}
